<template>
  <el-dialog title="选择用户" :visible.sync="visible" width="width:1000px" append-to-body>
    <XmTable :config="{
      ...tableConfig,
      ...customConfig
    }" :noWatchParams="noWatchParams" class="table" ref="table">
      <div slot="filter">
        <el-form class="fl" :inline="true" ref="form" :model="noWatchParams">
          <el-form-item label="登录账号">
            <el-input v-model.trim="noWatchParams.account" size="small" placeholder="登录账号" @keyup.enter.native="search" clearable></el-input>
          </el-form-item>
          <el-form-item label="城市">
            <CitySelect v-model.trim="noWatchParams.deptId" size="small" clearable></CitySelect>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="search" size="small" icon="el-icon-search" style="margin-left: 10px;">搜索
            </el-button>
          </el-form-item>
        </el-form>
      </div>
      <template slot="column-operate" slot-scope="{data}">
        <el-button type="primary" size="small" @click="select(data)">
          选择
        </el-button>
      </template>
    </XmTable>
  </el-dialog>
</template>

<script>
import {
  tableConfig, // 订单日志
} from './config'
export default {
  props: {
    customConfig: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      tableConfig,
      visible: false,
      noWatchParams: {
        account: '',
      },
    };
  },
  methods: {
    show() {
      this.visible = true
    },
    search() {
      this.$refs.table.fetch()
    },
    select(data) {
      this.$emit('select', data)
      this.visible = false
    }
  }
};
</script>
<style lang="scss" scoped>
</style>